<style>
#ag-menu{}
#ag-menu .search{height:65px;background-color:#2FBDE1;border-radius: 5px;}
#ag-menu .search input{width: 140px;margin: 14px 0 0 19px;border: none;border-radius: 5px;height:28px;}

#ag-menu .search a{display: inline-block;margin: 15px 0 0 15px;}

#ag-menu .cate{}
#ag-menu .cate dt{margin-top:3px;line-height:43px;text-align:center;font-weight: bold;letter-spacing: 20px;background:#E1E8EE url(/weixin/img/menu-off.png) no-repeat 210px;cursor: pointer;border-radius: 5px;}
#ag-menu .cate dt.menuon{background:#E1E8EE url(/weixin/img/menu-on.png) no-repeat 210px;}
#ag-menu .cate dd{background-color:#2EBEE1;display:none;}
#ag-menu .cate dd a{background-color:#F2F6F9;line-height:37px;display:block;text-align:center;color:#3C3431;letter-spacing: 20px;font-weight: bold;}
#ag-menu .cate dd .current{margin-left:8px;background-color:#fff;}
</style>
<script>
function closeAll(){
	$(".fcate dd").hide();
	$(".fcate dt").removeClass('menuon');
}
function showCurrent(){
	$("#ag-menu .current").parent().show('slow');
	$("#ag-menu .current").parent().parent().find('dt').addClass('menuon');
}
function showClick(obj){
	$(obj).siblings("dd").show('slow');
	$(obj).addClass('menuon');
}
$(document).ready(function(){
	showCurrent();
	$(".fcate dt").click(function(){
		closeAll();
		//showCurrent();
		showClick(this);
	});
});

</script>

<div id="ag-menu">
	<div class="search">
		<form action="<?=n_url('mprank','search')?>">
			<input type="text" name="group" placeholder="请输入搜索内容" />
			<a href="javascript:void(0);" onclick="$(this).parent().submit();"><img src="/index/img/search-btn.png" /></a>
		</form>
	</div>

	<div class="cate">
		<?php
		foreach($data['index'] as $key=>$val){
			foreach($val as $key1=>$val1){
				$cinfo = $data['cateTree'][$key1];
			?>
				<dl class="fcate">
					<dt>
						<?=$key1?>
						</dt>
					<dd>
						<?php
						foreach($cinfo as $key2=>$val2){
							?>
							<a href="?cid=<?=$val2['id']?>" class="<?=$val2['id']==$data['current']?'current':''?>"><?=$val2['second_category']?></a>
							<?php
						}
						?>
					</dd>
				</dl>
			<?php
		}
		}
		?>
	</div>
</div>
